// Copyright (C) Kumo inc. and its affiliates.
// Author: Jeff.li lijippy@163.com
// All rights reserved.
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <https://www.gnu.org/licenses/>.
//


#include <turbo/flags/flag.h>
#include <pollux/exec/aggregate.h>
#include <pollux/functions/coverage_util.h>
#include <pollux/functions/sparksql/aggregates/register.h>
#include <pollux/functions/sparksql/registration/register.h>
#include <pollux/functions/sparksql/window/window_functions_registration.h>

TURBO_FLAG(bool,all, false, "Generate coverage map for all Spark functions");

using namespace kumo::pollux;

int main(int argc, char** argv) {
  gflags::ParseCommandLineFlags(&argc, &argv, true);

  // Register all simple and vector scalar functions.
  functions::sparksql::registerFunctions("");

  // Register Spark aggregate functions.
  functions::aggregate::sparksql::registerAggregateFunctions("");

  // Register Spark window functions.
  functions::window::sparksql::registerWindowFunctions("");

  if (FLAGS_all) {
    functions::printCoverageMapForAll(":spark");
  } else {
    functions::printPolluxFunctions({}, ":spark");
  }

  return 0;
}
